public class PersonTest {
    public static void main(String[] args) {
        Person p = new Person();//向上转型
        if (p instanceof Worker) {
            Worker w = (Worker) p;//向下转型
            System.out.println("转换成功");
        }else {
            System.out.println("不能转换");
        }
    }
}
